package teamGiga.dao;

import java.util.HashMap;
import java.util.List;

import teamGiga.bean.MovieBean;
import teamGiga.bean.MovieMemberBean;
import teamGiga.bean.ParamBean;
import teamGiga.bean.QnaBean;
import teamGiga.bean.RequestBean;
import teamGiga.bean.ShowingBean;
import teamGiga.bean.TheaterBean;
import teamGiga.bean.TheaterRoomBean;
import teamGiga.bean.ZipCodeBean;

import com.ibatis.sqlmap.client.SqlMapClient;

public class MovieDao {
	static SqlMapClient sqlMapper;	
	static{
		sqlMapper=util.ServiceUtil.getSqlMapClient();
	}
	public static List<TheaterBean> getT()throws Exception{
		return sqlMapper.queryForList("teamGiga.dao.movie.gett");
	}
	public static List<TheaterRoomBean> getTr(HashMap<Object, Object>mlist)throws Exception{
		return sqlMapper.queryForList("teamGiga.dao.movie.gettr",mlist);
	}
	public static List<ShowingBean> getShowing()throws Exception{
		return sqlMapper.queryForList("teamGiga.dao.movie.getShowing");
	}
	public static void settr(TheaterRoomBean bean)throws Exception{
		sqlMapper.insert("teamGiga.dao.movie.inTR", bean);
	}
	public static MovieMemberBean checkPw(String id)throws Exception{
		return (MovieMemberBean) sqlMapper.queryForObject("teamGiga.dao.movie.checkPw", id);
	}
	public static void InsertMeber(MovieMemberBean bean)throws Exception{
		sqlMapper.insert("teamGiga.dao.movie.InsertMeber" ,bean);
	}
	public static List<MovieMemberBean>getMember()throws Exception{
		return sqlMapper.queryForList("teamGiga.dao.movie.getMember");
	}
	public static List<MovieBean>getMovie()throws Exception{
		return sqlMapper.queryForList("teamGiga.dao.movie.getMovie");
	}
	public static List<ZipCodeBean>getSido()throws Exception{
		return sqlMapper.queryForList("teamGiga.dao.movie.getSido");
	}
	public static List<ZipCodeBean>getGugun()throws Exception{
		return sqlMapper.queryForList("teamGiga.dao.movie.getGugun");
	}
	public static void insertMovie(MovieBean mbean)throws Exception{
		sqlMapper.insert("teamGiga.dao.movie.insertMovie",mbean);
	}
	public static void insertTheater(TheaterBean tbean)throws Exception{
		sqlMapper.insert("teamGiga.dao.movie.insertTheater",tbean);
	}
	public static void insertShowing(ShowingBean sbean)throws Exception{
		sqlMapper.insert("teamGiga.dao.movie.insertShowing",sbean);
	}
	public static void insertQna(QnaBean qbean) throws Exception{
		sqlMapper.insert("teamGiga.dao.movie.insertQna", qbean);
	}
	public static List<QnaBean>getQna(HashMap<Object, Object>map) throws Exception{		
		return sqlMapper.queryForList("teamGiga.dao.movie.getQna",map);
	}
	public static void qnaHit(int no)throws Exception{		
		sqlMapper.update("teamGiga.dao.movie.qnaHit", no);
	}
	public static Object selectQnaInfo(int no)throws Exception{		
		return sqlMapper.queryForObject("teamGiga.dao.movie.selectQnaInfo", no);
	}
	public static void modifyQna(QnaBean qbean)throws Exception{
		System.out.println("modify dao");
		sqlMapper.update("teamGiga.dao.movie.modifyQna", qbean);
	}
	public static void qnaDelete(int no)throws Exception{
		sqlMapper.delete("teamGiga.dao.movie.qnaDelete", no);
	}
	public static Integer getTotalRow(HashMap<String, String>map)throws Exception{
		return (Integer)sqlMapper.queryForObject("teamGiga.dao.movie.getTotalRow",map);
	}
	public static void insertRequest(RequestBean rbean) throws Exception{
		sqlMapper.insert("teamGiga.dao.movie.insertRequest",rbean);
	}
	public static RequestBean reqInfo(int rno) throws Exception{
		return (RequestBean)sqlMapper.queryForObject("teamGiga.dao.movie.reqInfo",rno);
	}
	public static void modifyReq(RequestBean bean) throws Exception{
		sqlMapper.update("teamGiga.dao.movie.reqModify",bean);
	}
	public static void deleteReq(int rno) throws Exception{
		sqlMapper.delete("teamGiga.dao.movie.reqDelete",rno);
	}
	public static void reqHit(int rno) throws Exception{
		sqlMapper.update("teamGiga.dao.movie.reqHit",rno);
	}
	public static List<RequestBean>reqList(HashMap<Object, Object>map) throws Exception{
		return sqlMapper.queryForList("teamGiga.dao.movie.reqList",map);
	}
	public static Integer getTotalRowReq(HashMap<String, String>map)throws Exception{
		return (Integer)sqlMapper.queryForObject("teamGiga.dao.movie.getTotalRowReq",map);
	}
}
